package com.dissertation.model;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;


@Document( collection = "assets" )
@CompoundIndex(name = "name_author", def = "{author:1, name:1}") // 联合主键
public class Assets {

    @Id
    private String id;

    @Excel(name = "语义标签_winning," +
            "语义标签_scientificProject," +
            "语义标签_academicPapers," +
            "语义标签_patent," +
            "语义标签_work," +
            "语义标签_achievements," +
            "语义标签_academic," +
            "语义标签_competition," +
            "语义标签_project," +
            "语义标签_studentPatent," +
            "语义标签_educationProject," +
            "语义标签_educationPaper," +
            "语义标签_textbook," +
            "语义标签_teacherTrain," +
            "语义标签_teacherAward," +
            "语义标签_raceGuide," +
            "语义标签_practiceBase," +
            "语义标签_lab",orderNum ="3")
    private List<String> tag; // 标签名

    @NotEmpty
    @Excel(name = "姓名_PeopleManage," +
            "获奖科研成果名称_winning," +
            "项目名称_scientificProject," +
            "学术论文题目_academicPapers," +
            "授权专利名称_patent," +
            "著作题目_work," +
            "成果采纳名称_achievements," +
            "学生论文题目_academic," +
            "获奖项目名称_competition," +
            "项目名称_project," +
            "项目名称_studentPatent," +
            "项目名称_educationProject," +
            "学术论文题目_educationPaper," +
            "著作题目_textbook," +
            "会议名称_teacherTrain," +
            "项目名称_teacherAward," +
            "竞赛名称_raceGuide," +
            "实验室_lab,",orderNum = "0")
    private String name; // 项目名or姓名

    @JsonIgnore
    private boolean deleted = false; // true表示已经删除

    @NotEmpty( message = "2级目录名字 不能为空" )
    @Excel(name = "二级目录名字",orderNum = "30")
    private String categoryLeafName; //2级目录名字
    @Excel(name = "一级目录名字",orderNum = "31")
    @NotEmpty( message = "1级目录名字 不能为空" )
    private String categoryTreeName; //1级目录名字

    private String uploader; // 上传者 user 唯一账号

    private double completeRate; // 完整度

    private List<String> otherTextInfo = Collections.emptyList(); //其他text信息

    private List<String> otherFileInfo = Collections.emptyList(); //其他file信息

    private Set<String> relative = Collections.emptySet(); // 关系人name
    @Excel(name="其他完成人_winning," +
            "其他参与人_scientificProject," +
            "我校其他合作者_academicPapers," +
            "我校其他发明人_patent," +
            "我校其他参与人_work," +
            "其他参与人_achievements," +
            "我校其他合作者_academic," +
            "其他参与人_competition," +
            "其他参与人_project," +
            "其他参与人_studentPatent," +
            "其他参与人_educationProject," +
            "我校其他合作者_educationPaper," +
            "我校其他参与人_textbook," +
            "我校其他参与人_teacherTrain," +
            "其他参与人_teacherAward," +
            "参与学生_raceGuide,",
            orderNum = "14_winning," +
                    "20_scientificProject," +
                    "4_academicPapers," +
                    "4_patent," +
                    "4_work," +
                    "4_achievements," +
                    "4_academic," +
                    "4_competition," +
                    "4_project," +
                    "4_studentPatent," +
                    "4_educationProject," +
                    "4_educationPaper," +
                    "4_textbook," +
                    "4_teacherTrain," +
                    "4_teacherAward," +
                    "4_raceGuide,")
    private Set<String> participantNames = Collections.emptySet(); // 参与者Name


    @NotEmpty
    @Excel(name = "第一完成人_winning," +
            "主持人_scientificProject," +
            "第一作者_academicPapers," +
            "第一发明人_patent," +
            "第一作者_work," +
            "第一完成人_achievements," +
            "第一作者_academic," +
            "第一完成人_competition," +
            "主持人_project," +
            "第一发明人_studentPatent," +
            "第一责任人_educationProject," +
            "第一作者_educationPaper," +
            "第一作者_textbook," +
            "参加人_teacherTrain," +
            "第一责任人_teacherAward,",orderNum="1")
    private String author; // 第一作者

    @NotEmpty
    @Excel(name = "授奖时间_winning," +
            "立项时间_scientificProject," +
            "发表日期_academicPapers," +
            "授权日期_patent," +
            "出版时间_work," +
            "采纳时间_achievements," +
            "发表日期_academic," +
            "授奖时间_competition," +
            "计划时间_project," +
            "发表日期_educationPaper," +
            "出版日期_textbook," +
            "会议时间_teacherTrain," +
            "授奖时间_teacherAward," +
            "获奖时间_raceGuide," +
            "成立时间_lab,",orderNum = "2")
    private String date; // 立项时间 yyyy-MM-dd

    private int importNum; // 导出次数


    public Set<String> getParticipantNames() {
        return participantNames;
    }

    public void setParticipantNames( Set<String> participantNames ) {
        this.participantNames = participantNames;
    }

    public int getImportNum() {
        return importNum;
    }

    public void setImportNum( int importNum ) {
        this.importNum = importNum;
    }

    public String getId() {
        return id;
    }

    public void setId( String id ) {
        this.id = id;
    }

    public List<String> getTag() {
        return tag;
    }

    public void setTag( List<String> tag ) {
        this.tag = tag;
    }

    public boolean isDeleted() {
        return deleted;
    }

    public void setDeleted( boolean deleted ) {
        this.deleted = deleted;
    }

    public String getCategoryLeafName() {
        return categoryLeafName;
    }

    public void setCategoryLeafName( String categoryLeafName ) {
        this.categoryLeafName = categoryLeafName;
    }

    public String getCategoryTreeName() {
        return categoryTreeName;
    }

    public void setCategoryTreeName( String categoryTreeName ) {
        this.categoryTreeName = categoryTreeName;
    }

    public String getUploader() {
        return uploader;
    }

    public void setUploader( String uploader ) {
        this.uploader = uploader;
    }

    public double getCompleteRate() {
        return completeRate;
    }

    public void setCompleteRate( double completeRate ) {
        this.completeRate = completeRate;
    }

    public Set<String> getRelative() {
        return relative;
    }

    public void setRelative( Set<String> relative ) {
        this.relative = relative;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor( String author ) {
        this.author = author;
    }

    public String getDate() {
        return date;
    }

    public void setDate( String date ) {
        this.date = date;
    }

    public List<String> getOtherTextInfo() {
        return otherTextInfo;
    }

    public void setOtherTextInfo(List<String> otherTextInfo) {
        this.otherTextInfo = otherTextInfo;
    }

    public List<String> getOtherFileInfo() {
        return otherFileInfo;
    }

    public void setOtherFileInfo(List<String> otherFileInfo) {
        this.otherFileInfo = otherFileInfo;
    }

    public String getName() {
        return name;
    }

    public void setName( String name ) {
        this.name = name;
    }
}
